package com.icode.core.shared;

import com.icode.core.dto.order.ReFundDTO;
import com.icode.service.order.OrderService;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: xianfei
 * Date: 15-4-29
 * Time: 上午11:28
 * To change this template use File | Settings | File Templates.
 */
public class OrderHandle {

    public static void ajaxRefundData(String status, OrderService orderService, HttpServletResponse response) {
        List<ReFundDTO> reFundDTOs;
        switch (status) {
            case "refunded":
                reFundDTOs = orderService.findRefundByStatus("已退款");
                DataToJson.refundDataToJson(reFundDTOs, response);
                break;
            case "noRefund":
                reFundDTOs = orderService.findRefundByStatus("待审核");
                DataToJson.refundDataToJson(reFundDTOs, response);
                break;
            case "rejected":
                reFundDTOs = orderService.findRefundByStatus("已驳回");
                DataToJson.refundDataToJson(reFundDTOs, response);
                break;
            default:
                reFundDTOs = orderService.findAllReFund();
                DataToJson.refundDataToJson(reFundDTOs, response);
                break;
        }
    }

}
